'use strict';

angular.module('com.dcos.app').factory('EnvironmentService', function ($http) {
	return {
		getlist: function (project_id) {
	      return $http({
	        method: 'POST',
	        url:'/v1/env/list',
	        data:JSON.stringify({project_id:project_id}),
	        headers: {'Content-type': 'application/json','Accept': 'application/json'}
	      })
	    },
		add: function (data) {
	      return $http({
	        method: 'POST',
	        url:'/v1/env/add',
	        data:JSON.stringify(data),
	        headers: {'Content-type': 'application/json','Accept': 'application/json'}
	      })
	    },
		detail: function (e_id,c_id) {
	      return $http({
	        method: 'POST',
	        url:'/v1/env/listdetail',
	        data:JSON.stringify({environ_id:e_id,component_id:c_id}),
	        headers: {'Content-type': 'application/json','Accept': 'application/json'}
	      })
	    },
		update: function (data) {
	      return $http({
	        method: 'POST',
	        url:'/v1/env/update',
	        data:JSON.stringify(data),
	        headers: {'Content-type': 'application/json','Accept': 'application/json'}
	      })
	    },
		delete: function (id) {
	      return $http({
	        method: 'POST',
	        url:'/v1/env/delete',
	        data:JSON.stringify({id:id}),
	        headers: {'Content-type': 'application/json','Accept': 'application/json'}
	      })
	    }
	}
});
